import request from '@/utils/request'
import { params } from 'webcamjs'



export function getUserList(pageNum,pageSize) {//获取用户列表
    return request({
        url: '/system/user/list',
        headers: {
            isToken: true
        },
        method: 'get',
        params: {
            pageNum,pageSize
        }
    })
}
export function getUserCode() {//获取用户列表
    return request({
        url: '/system/user/getUserCode',
        headers: {
            isToken: true
        },
        method: 'get',
    })
}

//    // 新增切换供应商状态的函数
export function changeSupplierStatus(wmsBasicClientObject) {
    return request({
      url: '/system/supplier',
      method: 'put',
      data: wmsBasicClientObject
    });
  }
  
//idex.vue编辑备注
export function updateCheckRemark(params) {
  return request({
    url: '/system/checkOrder/editRemark',
    method: 'put',
    data: params,
    
  });
}
// 删除入库单函数，移到这里

export function deleteInboundOrders(inboundOrderId) {
    const url = `/v2/wms-inbound-order/${inboundOrderId}`; // 确保URL正确
    return request({
      url: url,
      method: 'DELETE',
    });
  }
export function changeStatus(statusForm) {//用户的启用停用
    return request({
        url: '/system/user/changeStatus',
        headers: {
            isToken: true
        },
        method: 'put',
        data: statusForm
    })
}

export function search(pageNum,pageSize,userName,nickName,status) {//查询
    return request({
        url: '/system/user/list',
        headers: {
            isToken: true
        },
        method: 'get',
        params: {
            pageNum,pageSize,userName,nickName,status
        }
    })
}
export function addUser(userForm) {//添加用户
    return request({
        url: '/system/user',
        headers: {
            isToken: true
        },
        method: 'post',
        data: userForm
    })
}
export function updateUser(userForm) {//编辑用户
    return request({
        url: '/system/user',
        headers: {
            isToken: true
        },
        method: 'put',
        data: userForm
        // params:{
        //     userId
        // }
    })
}
export function deleteUser(userId) {//删除用户
    return request({
        url: '/system/user/' + userId,
        headers: {
            isToken: true
        },
        method: 'delete',
        // params:{
        //     userId
        // }
    })
}

export function getRoleList( paramsObj ) {//获取角色列表
    return request({
        url: '/system/role/list',
        headers: {
            isToken: true
        },
        method: 'get',
        params: paramsObj
        // params: {
        //     pageNum, pageSize, roleCode, roleName
        // }
    })
}

export function getMenuList() {//获取权限列表
    return request({
        url: '/system/menu/roleMenuTreeselectAll',
        headers: {
            isToken: true
        },
        method: 'get',
    })
}
export function getRoleInfo(roleId) {//获取角色权限表
    return request({
        url: '/system/menu/roleMenuTreeselect/'+roleId,
        headers: {
            isToken: true
        },
        method: 'get',
    })
}
export function getRoleCode() {//获取角色编码
    return request({
        url: '/system/role/getRoleCode',
        headers: {
            isToken: true
        },
        method: 'get',
    })
}
export function addRole(rolEForm) {//新增角色
    return request({
        url: '/system/role',
        headers: {
            isToken: true
        },
        method: 'post',
        data: rolEForm
    })
}
export function deleteRole(roleId) {//删除角色
    return request({
        url: '/system/role/' + roleId,
        headers: {
            isToken: true
        },
        method: 'delete',
        // params:{
        //     userId
        // }
    })
}
export function updateRole(roleForm) {//修改角色
    return request({
        url: '/system/role/',
        headers: {
            isToken: true
        },
        method: 'put',
        data: roleForm
    })
}

export function getTenantList(pageNum,pageSize) {//获取租户列表
    return request({
        url: '/system/tenant/list',
        headers: {
            isToken: true
        },
        method: 'get',
        params: {
            pageNum,pageSize
        }
    })
}
export function addTenant(tenantForm) {//新增租户
    return request({
        url: '/system/tenant',
        headers: {
            isToken: true
        },
        method: 'post',
        data: tenantForm
    })
}
export function updateTenant(tenantForm) {//编辑租户
    return request({
        url: '/system/tenant/',
        headers: {
            isToken: true
        },
        method: 'put',
        data: tenantForm
    })
}
export function deleteTenant(tenantId) {//删除租户
    return request({
        url: '/system/tenant/' + tenantId,
        headers: {
            isToken: true
        },
        method: 'delete',
    })
}

export function getTenantCode() {//获取租户编号
    return request({
        url: '/system/tenant/getTenantCode',
        headers: {
            isToken: true
        },
        method: 'get',
    })
}

export function getAdminUsers() {//获取跟进人
    return request({
        url: '/system/tenant/getAdminUsers',
        headers: {
            isToken: true
        },
        method: 'get',
    })
}


